import {h, init} from "snabbdom"
let patch = init([])
let vnode = h("div#container",[
    h("h1", "this is h1"),
    h("h2", "this is h2"),
    h("p", "这是通过h函数创建的虚拟节点node")
])

let app = document.querySelector("#app")
let oldVnode = patch(app, vnode)

setTimeout(() =>{
    vnode = h("div#container",[
        h("h1", "这是2秒后改变的标题"),
        h("p", "this is p")
    ])
    patch(oldVnode, vnode)
},2000)
setTimeout(() =>{
    // 清空页面中的元素
    vnode = h("!")
    patch(oldVnode, vnode)
},3000)